import { post } from "../utils/request";
import { get } from "../utils/request";

/**
 * 用户登录
 * @param {*} data
 * @returns
 */
export const login = (data) => post("/api/v1/auth/login", data);

/**
 * 用户注册
 * @param {*} data
 * @returns
 */
export const reg = (data) => post("/api/v1/auth/reg", data);

// 获取用户信息
export const yonghu = () => get("/api/v1/users/info");

// 修改用户信息
/* 
url
  /api/v1/users/change_info
method
  post
params
  nickName
  avatar
headers
  authorization Bearer token  // 需要提供jwt信息
*/
export const changeInfo = (data) => post("/api/v1/users/change_info", data);


/*
  上传文件 
url
  /api/v1/common/file_upload
method
  post
params
  file
*/
export const fileUpLoad = (file) => post("/api/v1/common/file_upload", file);


// 修改登录密码
export const ChangePwd = (data) => post("/api/v1/users/change_pwd", data);